<?php $this->load->module('mobile/index/header', $common);?>

<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/dialog.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/base.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/index.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/line.css" />
<script type="text/javascript" src="<?php echo URLPRE;?>static/template/default/mobile/js/mobilecommon.js"></script>
<script type="text/javascript" src="<?php echo URLPRE;?>static/template/default/mobile/js/slider.js"></script>
<script type="text/javascript" src="<?php echo URLPRE;?>static/template/default/mobile/js/dialog.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/flight.css" />
<script>
    var scity = '<?php echo $Scity ;?>' ;
    var ecity = '<?php echo $Ecity ; ?>' ;
    var sdate = '<?php echo $Sdate ;?>' ;
    var airtax = '<?php echo $Airtax ;?>';
    var fees =   '<?php echo $Fees ;?>';
    var price =  '<?php echo $Price ;?>';
</script>
    <div class="content">
    <section class="flight j_toEmpty" id="flightInfo">

        <!--S H5机票_订单填写 one-->
        <!-- 航班信息 -->
        <div class="flight-bkinfo">
            <div class="flight-bkinfo-journey">
                <div class="flight-bkinfo-from">
                    <p class="flight-bkinfo-date">
                        <i class="flight-icon-go" style="display: none;">去</i>
                        <span id="js_dtime" ><?php echo $current_date ;?></span>
                    </p>
                    <p class="flight-bkinfo-time"><?php echo $Stime ;?></p>
                    <p class="flight-bkinfo-airport"><?php echo $sairport ;?></p>
                </div>
                <div class="flight-bkinfo-end">
                    <p class="flight-bkinfo-date">
                        <span><?php echo $current_date ;?></span>
                    </p>
                    <p class="flight-bkinfo-time"><?php echo $Etime ;?></p>
                    <p class="flight-bkinfo-airport"><?php echo  $eairport;?></p>
                </div>



                <div class="flight-bkinfo-direction">
                    <div class="line"></div>
                </div>
            </div>
            <div class="flight-bkinfo-fltinfo2"><span><?php echo $airline_name ;?></span><span><?php echo $Airline ;?></span></div>
            <div class="flight-bkinfo-price j_hd">
                <p>
            	<span class="j_policy">
    	    		经济舱&nbsp;
    			</span>
                    <span class="clr-ff7d13">¥<?php echo $Price ;?></span>
                    <span>&nbsp;&nbsp;机/油&nbsp;</span>
                    <span class="clr-ff7d13">¥<?php echo $Airtax ;?></span>
                    <span class="j_toShow flight-arrrht j_RC" id="fchang_button">退改签</span>
                </p>
            </div>
        </div>


        <div class="flight-pnttips js_hide">
            <h4>成人退票：</h4>
            <div class="flight-mask-h4cnt">
                <p><?php echo $return ;?></p>
            </div>
            <h4>成人改签：</h4>
            <div class="flight-mask-h4cnt">
                <p><?php echo $change ;?></p>
            </div>
           </div>
    </section>
    <article id="flightBox" class="j_toEmpty">
    <!-- 乘机人新UI -->
    <div class="flight-psinfo">
        <ul id="addPassenger" class="flight-listsim3 mtm1">
            <li data-id="1425543792764" class="flight-psinfo-fstps">
                <div class="flight-infoinput">
                    <ul>
                        <li id="cname-container-1425543792764" class="js_canme-container" style="">
                            <div class="flight-infoinput-pdl clear-input-box">
                                <label class="flight-labq">乘机人</label>
                                <input placeholder="乘机人姓名" class="js_newName" name="tourist_name">
                            </div>
                        </li>
                        <li>
                            <div class="flight-infoinput-pdl clear-input-box">
                                <select id="sel_idCard-1425543792764" name="tourist_card_type" style="display: none">
                                    <option value="1">身份证</option>
                                    <option value="2">护照</option>
                                    <option value="4">军人证</option>
                                </select>
                                <label class="flight-arrdown">证件号码</label>
                                <input type="text"  placeholder="护照/身份证" class="js_no" name="tourist_card_num">
                                <div class="flight-identity-no" data-type="1" data-index="0"></div>
                            </div>
                        </li>

                        <li data-id="1425543792764" style="display: none;">
                            <div class="flight-iptetp" data-psgidx="0">
                        <span class="flight-iptetp-current">
                            <em class="fnt-14">成人票</em>
                            <br>
                            <em class="fnt-12">总计</em>
                            <em class="fnt-14 clr-ff7d13">¥<?php echo $Price+$Airtax ;?></em>
                        </span>
                            </div>
                        </li>
                    </ul>
                </div>
            </li>

        </ul>
    </div>

    <div class="flight-bxinfo mt10">
        <div class="flight-section clear-input-box">
            <label>联系人</label>
            <input name="contact_name"  class="flight-linktel" placeholder="姓名" type="text" maxlength="25">
        </div>
    </div>
    <div class="flight-bxinfo mt10">
        <div class="flight-section clear-input-box">
            <label>手机号</label>
            <input name="contact_phone" class="flight-linktel" placeholder="11位手机号" type="text" maxlength="25">
        </div>
    </div>

    </article>
    <section class="fpay j_Fpay" id="paybox">
        <div class="money js_fixed">
    <span class="money-total">
    	¥ <em class="fs"><?php echo $Price+$Airtax ;?></em>
	</span>
            <div class="money-btnpd">
                <span class="j_btn money-btn btn_submit">提交订单</span>
            </div>
        </div>
    </section>
    <input type="hidden" value="<?php echo $Scity ;?>"  name="scity">
    <input type="hidden" value="<?php echo $Ecity ; ?>" name="ecity">
    <input type="hidden" value="<?php echo $Sdate ;?>"  name="sdate">
    <input type="hidden" value="<?php echo $RateId ;?>" name="rateid">
    <input type="hidden" value="<?php echo $PolicyId ;?>" name="policyid">
    <input type="hidden" value="<?php echo $Cabins ;?>" name="cabins">
    <input type="hidden" value="<?php echo $Airline ;?>" name="airline">
    <input type="hidden" value="<?php echo $Airtax ;?>" name="airtax">
    <input type="hidden" value="<?php echo $Fees ;?>" name="fees">
    <input type="hidden" value="<?php echo $Price ;?>" name="price">
    <input type="hidden" value="<?php echo $start_date ;?>" name="start_date">
    <input type="hidden" value="<?php echo $scityname ;?>" name="scityname">
    <input type="hidden" value="<?php echo $ecityname ;?>" name="ecityname">
    <input type="hidden" value="<?php echo $airline_name ;?>" name="airline_name">
    <input type="hidden" value="<?php echo $DotNum ;?>" name="dotnum">
    <input type="hidden" value="<?php echo $Stime ;?>" name="stime">
    <input type="hidden" value="<?php echo $sairport ;?>" name="sairport">
    <input type="hidden" value="<?php echo $Etime ;?>" name="etime">
    <input type="hidden" value="<?php echo $eairport ;?>" name="eairport">
    <input type="hidden" value="<?php echo $return ;?>" name="return">
    <input type="hidden" value="<?php echo $change ;?>" name="change">
    <input type="hidden" value="<?php echo $referer ;?>" name="referer">

    </div>
<?php $this->load->module('mobile/index/footer', $common);?>

<script type="text/javascript">

    function alert_popup(text){
        $.dialog({
            style:'tip',
            width:200,
            closeTime:1000,
            content: '<p style="text-align: center">'+text+'</p>'
        }).open();
    }

    $(function(){

        $('#fchang_button').click(function(){

            var freturn = $('input[name="return"]').val();
            var fchange = $('input[name="change"]').val();
            $.dialog({
                style:'tip',
                height:'100%',
                width:'100%',
                closeTime:5000,
                content: '<p style="text-align: center">'+freturn+'</br>'+fchange+'</p>'
            }).open();
        })


        $('.btn_submit').click(function(){

            if($('input[name="tourist_name"]').val().length == 0){
                alert_popup('请输入乘机人姓名');
                return false;
            }

            if($('input[name="tourist_card_num"]').val().length == 0){
                alert_popup('请输入乘机人身份证号');
                return false;
            }
            if($('input[name="contact_name"]').val().length == 0){
                alert_popup('请输入联系人姓名');
                return false;
            }

            if($('input[name="contact_phone"]').val().length == 0){
                alert_popup('请输入联系人手机号');
                return false;
            }else {
                var $val = $("input[name='contact_phone']").val();
                var length = $val.length;
                var status = (length == 11 && /^(((17[0-9]{1})|(13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test($val));
                if(status==false){
                    alert_popup('请正确填写您的手机号码');
                    return false;
                }
            }

            var tourist_name = $('input[name="tourist_name"]').val();
            var tourist_card_num = $('input[name="tourist_card_num"]').val();
            var contact_name =  $('input[name="contact_name"]').val();
            var contact_phone = $('input[name="contact_phone"]').val();
            var scity = $('input[name="scity"]').val();
            var ecity = $('input[name="ecity"]').val();
            var sdate = $('input[name="sdate"]').val();
            var rateid = $('input[name="rateid"]').val();
            var policyid = $('input[name="policyid"]').val();
            var cabins = $('input[name="cabins"]').val();
            var airline = $('input[name="airline"]').val();
            var dotnum = $('input[name="dotnum"]').val();
            var freturn = $('input[name="freturn"]').val();
            var fchange = $('input[name="fchange"]').val();

            $.dialog({
                style:'tip',
                width:200,
                closeTime:1000,
                content: '<p style="text-align: center">正在提交...</p>'
            }).open();

            $.post('<?php echo $form_url ;?>',{
                tourist_name:tourist_name,
                tourist_card_num:tourist_card_num,
                contact_name:contact_name,
                contact_phone:contact_phone,
                scity:scity,
                ecity:ecity,
                sdate:sdate,
                rateid:rateid,
                policyid:policyid,
                cabins:cabins,
                airline:airline,
                dotnum:dotnum,
                freturn:freturn,
                fchange:fchange
            },function(data){
                alert_popup(data.info);
                if(data.status=='1')
                {
                    setTimeout(function(){
                        window.location.href='<?php echo site_url('mobile/order/flight_list') ?>';
                    }, 1200);
                }
            },'json')
        })
       })
</script>